package com.sugon.service.impl;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import com.sugon.dao.SpecialDevCheckRecordDao;
import com.sugon.entity.SpecialDevCheckRecordEntity;
import com.sugon.service.SpecialDevCheckRecordService;
import com.sugon.utils.Constant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 特种设备校验台账单Service实现类
 *
 * @author sugon
 * @date 2020-12-17 14:16:21
 */
@Service("specialDevCheckRecordService")
public class SpecialDevCheckRecordServiceImpl implements SpecialDevCheckRecordService {
    @Autowired
    private SpecialDevCheckRecordDao specialDevCheckRecordDao;

    @Override
    public SpecialDevCheckRecordEntity queryObject(String id) {
        return specialDevCheckRecordDao.queryObject(id);
    }

    @Override
    public List<SpecialDevCheckRecordEntity> queryList(Map<String, Object> map) {
        return specialDevCheckRecordDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return specialDevCheckRecordDao.queryTotal(map);
    }

    @Override
    public int save(SpecialDevCheckRecordEntity specialDevCheckRecord) {
        specialDevCheckRecord.setId(RandomUtil.randomString(32));
        specialDevCheckRecord.setDelFlag(Constant.IS_NOT_DEL_INT);
        specialDevCheckRecord.setGmtCreate(DateUtil.date());
        return specialDevCheckRecordDao.save(specialDevCheckRecord);
    }

    @Override
    public int update(SpecialDevCheckRecordEntity specialDevCheckRecord) {
        specialDevCheckRecord.setGmtModified(DateUtil.date());
        return specialDevCheckRecordDao.update(specialDevCheckRecord);
    }

    @Override
    public int delete(String id) {
        return specialDevCheckRecordDao.delete(id);
    }

    @Override
    public int deleteBatch(String[] ids) {
        return specialDevCheckRecordDao.deleteBatch(ids);
    }
}
